package com.cwolf.qr.activity;

import android.hardware.Camera;
import android.os.Handler;

/**
 * 定时对焦
 */
public class QrFocusCallBack implements Camera .AutoFocusCallback{
    @Override
    public void onAutoFocus(boolean success, final Camera camera) {
        if(camera==null){
            return;
        }
        if(success){
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    if(camera==null){
                        return;
                    }
                    try{
                        camera.autoFocus(QrFocusCallBack.this);
                    }catch (Exception e){
                    }

                }
            },1000);
        }

    }
}
